#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int N = 0; //存入整数的个数
    int arr[50] = { 0 }; //存入待检测的N个数
    int del = 0;  //存入待删除的数
    int j = 0;
    scanf("%d", &N);
    for (int i = 0;i < N;i++)
    {
        scanf("%d", arr + i);
    }
    scanf("%d", &del);
    for (int i = 0;i < N;i++)
    {
        if (arr[i] != del)
        {
            arr[j] = arr[i];
            j++;
        }
    }
    for (int i = 0;i < j;i++)
    {
        printf("%d ", arr[i]);
    }
	return 0;
}